package com.pacai.varparameter;

public class VarparamrterExercise {
    public static void main(String[] args) {
        Method method = new Method();
        System.out.println(method.getScore("meley", 67, 987, 11));
        int[] arr = {1,2,4,2,42,8};
        int[] arr2 = {1,2,4,2,42,8};
        int[] arr3 = {1,2,4,2,42,8};
        int[][] map = method.getMap(arr,arr2,arr3);
        for (int i = 0; i < map.length; i++) {
            for (int j = 0; j < map[i].length; j++) {
                System.out.print(map[i][j] + " ");
            }
            System.out.println();
        }
    }
}


class Method{
    public String getScore(String name,double... scores){
        double sum = 0.0;
        for (int i = 0; i < scores.length; i++) {
            sum += scores[i];
        }
        return name + sum;
    }
    public int[][] getMap(int[]... factors){
        int[][] map = new int[factors.length][];
        for (int i = 0; i < factors.length; i++) {
            map[i] = new int[factors[i].length];
            for (int j = 0; j < factors[0].length; j++) {
                map[i][j] = factors[i][j];
            }
        }
        return map;
    }
}